from rest_framework.response import Response


class APIResponse(Response):
    def __init__(self, data_status=0, msg="ok", results=None, http_status=200, headers=None, exception=False, **kwargs):
        data = {"code": data_status, "msg": msg}
        if results is not None:
            data["data"] = results
        data.update(**kwargs)
        super().__init__(data=data, status=http_status, headers=headers, exception=exception)
